import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class ToastUtil {
  static void showSuccess(String message) {
    Fluttertoast.showToast(
        msg: message, // 信息
        toastLength: Toast.LENGTH_SHORT, // 长度
        gravity: ToastGravity.TOP, // 位置
        backgroundColor: Colors.green, // 背景色
        textColor: Colors.white, // 文字颜色
        webPosition: 'center', // 网页端的位置
        webBgColor: '#5591af'); // 网页端的背景色
  }

  static void showError(String message) {
    Fluttertoast.showToast(
        msg: message,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        backgroundColor: Colors.red,
        textColor: Colors.white,
        webPosition: 'center',
        webBgColor: '#ff0000');
  }

  static void showInfo(String message) {
    Fluttertoast.showToast(
        msg: message,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        backgroundColor: Colors.blue,
        textColor: Colors.white,
        webPosition: 'center',
        webBgColor: '#0000ff');
  }
}
